package com.acme.bankapp.domain.account;

public abstract class AbstractAccount implements Account {

	protected int id;
	protected double balance;

	public AbstractAccount(final int id, final double amount) {
		this.balance = amount;
		this.id = id;
	}
	
	public AbstractAccount(final double amount) {
		this.balance = amount;
	}
	
	public double getBalance() {
		return balance;
	}
	
	protected void validateAmount(double amount) {
		if (amount < 0d)
			throw new IllegalArgumentException("Amount must be positive");
	}
	
	public int getId() {
		return id;
	}
	
	@Override
	public long decimalValue() {
		return (long) Math.floor(getBalance());
	}
}
